﻿/*
 * Microsoft .NET  2.0+ version of Sphinx searchd client (Sphinx API)
 * 
 * Copyright (c) 2009, Shaun Berryman
 * All rights reserved
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License. You should have
 * received a copy of the GPL license along with this program; if you
 * did not, you can find it at http://www.gnu.org/
 */

using System;
using System.Collections.Generic;
using System.Text;

namespace SphinxSearchApi.Model
{
    public class ExcerptOptions
    {
        /// <summary>
        /// A string to insert before a keyword match. Default is "<b>".
        /// </summary>
        public string BeforeMatch { get; set; }
        
        /// <summary>
        /// A string to insert after a keyword match. Default is "<b>".
        /// </summary>
        public string AfterMatch { get; set; }
        
        /// <summary>
        /// A string to insert between snippet chunks (passages). Default is " ... ".
        /// </summary>
        public string ChunkSeparator { get; set; }

        /// <summary>
        /// Maximum snippet size, in symbols (codepoints). Integer, default is 256.
        /// </summary>
        public int Limit { get; set; }

        /// <summary>
        /// How much words to pick around each matching keywords block. Integer, default is 5.
        /// </summary>
        public int Around { get; set; }

        /// <summary>
        /// Whether to highlight exact query phrase matches only instead of individual
        /// keywords. Boolean, default is false.
        /// </summary>
        public bool ExactPhrase { get; set; }

        /// <summary>
        /// Whether to extract single best passage only. Boolean, default is false.
        /// </summary>
        public bool SinglePassage { get; set; }

        /// <summary>
        /// Whether to sort the extracted passages in order of relevance (decreasing weight),
        /// or in order of appearance in the document (increasing position). Boolean, default is false.
        /// </summary>
        public bool WeightOrder { get; set; }

        public ExcerptOptions()
        {
            // Set our defaults
            BeforeMatch = "<b>";
            AfterMatch = "</b>";
            ChunkSeparator = " ... ";
            Limit = 256;
            Around = 5;
            ExactPhrase = false;
            SinglePassage = false;
            WeightOrder = false;
        }
    }
}
